import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import Components from "unplugin-vue-components/vite";
import { VantResolver } from "unplugin-vue-components/resolvers";

export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [VantResolver()],
    }),
  ],

  server: {
    cors: true,
    proxy: {
      "/article": {
        target: "http://localhost:8206",
        secure: false, // 如果是https接口，需要配置这个参数
        changeOrigin: true,
        logLevel: "debug",
      },
    },
  },
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
  //新增代理配置
});
